﻿using DeepEarth.Map.Core;

#if !WINDOWS_PHONE
using System.ComponentModel.Composition;
using DeepEarth.Map.Core.Tiling; 
#endif

namespace DeepEarth.Map.TileSources
{

#if !WINDOWS_PHONE
    [Export(typeof(BaseTileSourceProvider))] 
#endif
    public class QuadKeyTileSourceProvider : BaseTileSourceProvider<QuadKeyTileSourceFactory>
    {
        public string PathFormat
        {
            get { return _qts.PathFormatter.UriFormat; }
            set { _qts.PathFormatter.UriFormat = value; }
        }

        public string Culture
        {
            get { return _qts.PathFormatter.Culture; }
            set { _qts.PathFormatter.Culture = value; }
        }

        private readonly QuadKeyTileSource _qts;

        public QuadKeyTileSourceProvider()
			: base(QuadKeyTileSourceFactory.QuadKey)
        {
			var source = TileSourceFactory.CreateTileSource(Mode);
        	_qts = (QuadKeyTileSource) source;
            TileSourcesCollection.Add(_qts);
        }

        public override BaseTileSourceProvider Clone()
		{
			var result = new QuadKeyTileSourceProvider();
			FillClone(result);
			return result;
		}

	}
}
